<!--
Zeke Elder - zbe@andrew.cmu.edu
Amal Chemmany - achemman@andrew.cmu.edu
Nishant Kumar - nkumar1@andrew.cmu.edu
15-637
4/2/2012
-->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:if test="${user == null}">
<c:redirect url="welcome.jsp"/>
</c:if>
<html>
<head>
<title>Welcome to FitHub!</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
		<link rel="stylesheet" href="./css/colorbox.css" />
		<script src="./js/jquery.min.js"></script>
		<script src="./js/jquery.colorbox.js"></script>
		<script>
			$(document).ready(function(){
				$(".iframe").colorbox();
				$(".callbacks").colorbox({
					iframe:true, width:"80%", height:"90%",
					onClosed:function(){ window.location.reload(); }
				});
				
			});
		</script>
</head>
<body>

	<!-- include header.jsp -->
	<jsp:include page="./header.jsp" flush="false" />
	<div class="body_container">
		<div>
			<br /> <br /> <a class="callbacks" href="displayAddWorkout.do">Add a workout</a><br /> <br />
			<br /> <br />
		</div>
		<div>
			<c:choose>
				<c:when test="${fn:length(workoutDisplayList) < 1 }">
					<div>You need to schedule a workout!</div>
				</c:when>
				<c:otherwise>
					<table>
						<th>Date/Time</th>
						<th>Exercise</th>
						<th>Reps</th>
						<th></th>
						<c:forEach var="workout" items="${workoutDisplayList}">
							<tr>
								<td>${workout.date }</td>
								<td></td>
								<td></td>
								<td><a
									href="./deleteWorkout.do?scheduleId=${workout.id}&workoutId=${workout.workoutId}">remove
										workout</a></td>
								<c:forEach begin="0" end="${fn:length(workout.exercise) - 1}"
									varStatus="loop">
									<tr>
										<td></td>
										<td>${workout.exercise[loop.index].name}</td>
										<c:if test="${workout.reps[loop.index] > 0}">
											<td>${workout.reps[loop.index]}</td>
										</c:if>
									</tr>
								</c:forEach>
							</tr>
						</c:forEach>
					</table>
				</c:otherwise>
			</c:choose>
		</div>

	</div>

	<script src="./js/fithub.js"></script>
	<script src="./js/jquery.colorbox.js"></script>
</body>
</html>